package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

public interface UserMapper {


    @Select("select * from user where openid = #{openId}")
    User getUserByOpenId(String openId);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into user(openid,create_time) values (#{openid},#{createTime})")
    void addUser(User user);

    @Select("select * from user where id = #{userId}")
    User getById(Long userId);

    Integer getUsersCount(Map map);
}
